package design.simdi.code.final_paper.site.panels;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.wizard.Wizard;
import org.apache.wicket.extensions.wizard.WizardButtonBar;
import org.apache.wicket.markup.html.form.Form;

import design.simdi.code.final_paper.utils.AjaxCancelButton;
import design.simdi.code.final_paper.utils.AjaxFinishButton;
import design.simdi.code.final_paper.utils.AjaxNextButton;
import design.simdi.code.final_paper.utils.AjaxPreviousButton;

/**
 * 
 * @author Marius Dumitriu - (Jun 4, 2010 - 12:14:33 PM)
 * 
 */
public class MyWizardButtonBar extends WizardButtonBar {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3414512004669828379L;

	public MyWizardButtonBar(String id, Wizard wizard, Form<?> form) {
		super(id, wizard);
		get("cancel").replaceWith(new AjaxCancelButton("cancel", wizard, form) {

			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			public void onCancel(AjaxRequestTarget target) {
				onCancelClick(target);

			}

		});
		get("finish").replaceWith(new AjaxFinishButton("finish", wizard, form) {
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			public void onFinish(AjaxRequestTarget target) {
				onFinishClick(target);

			}
		});
		get("next").replaceWith(new AjaxNextButton("next", wizard, form) {
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			public void onNext(AjaxRequestTarget target) {
				onNextClick(target);
				target.addComponent(this.getPage().get("content"));
			}
		});

		get("previous").replaceWith(new AjaxPreviousButton("previous", wizard, form) {
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			public void onPrevious(AjaxRequestTarget target) {
				onPreviousClick(target);
				target.addComponent(this.getPage().get("content"));
			}
		});

	}

	public void onFinishClick(AjaxRequestTarget target) {

	}

	public void onCancelClick(AjaxRequestTarget target) {

	}

	public void onNextClick(AjaxRequestTarget target) {

	}

	public void onPreviousClick(AjaxRequestTarget target) {

	}

}
